﻿using System;
using System.ComponentModel;

namespace Loki
{
    internal class TaskStatus : ITaskStatus
    {
        #region  ID
        private static PropertyChangedEventArgs _IDChangeArgs = ObservableHelper.CreateArgs<TaskStatus>(x => x.ID);

        private Guid _ID;

        public Guid ID
        {
            get
            {
                return _ID;
            }

            set
            {
                if (value != _ID)
                {
                    _ID = value;
                    OnPropertyChanged(_IDChangeArgs);
                }
            }
        }
        #endregion

        #region  Status
        private static PropertyChangedEventArgs _StatusChangeArgs = ObservableHelper.CreateArgs<TaskStatus>(x => x.Status);

        private string _Status;

        public string Status
        {
            get
            {
                return _Status;
            }

            set
            {
                if (value != _Status)
                {
                    _Status = value;
                    OnPropertyChanged(_StatusChangeArgs);
                }
            }
        }
        #endregion

        #region  Percentage
        private static PropertyChangedEventArgs _PercentageChangeArgs = ObservableHelper.CreateArgs<TaskStatus>(x => x.Percentage);

        private double _Percentage;

        public double Percentage
        {
            get
            {
                return _Percentage;
            }

            set
            {
                if (value != _Percentage)
                {
                    _Percentage = value;
                    OnPropertyChanged(_PercentageChangeArgs);
                }
            }
        }
        #endregion

        #region PropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            PropertyChangedEventHandler L_Handler = PropertyChanged;

            if (L_Handler != null)
            {
                L_Handler(this, e);
            }
        }

        #endregion
    }
}
